package dome2;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) {
        try {
            Class<?> c = Class.forName("dome2.TestEnum");
            Constructor<?> declaredConstructor =
//            c.getDeclaredConstructor(int.class, String.class);
            c.getDeclaredConstructor(String.class,int.class,int.class, String.class);
            declaredConstructor.setAccessible(true);
            TestEnum testEnum = (TestEnum) declaredConstructor.newInstance(5,"橙色");
            System.out.println(testEnum);

        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}
